<%-- 
    Document   : login
    Created on : Jul 1, 2011, 8:35:49 AM
    Author     : PhongLK60473
--%>

<%@page import="Object.Page"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
        <style type="" >
            @import url("style/style.css");
            @import url("style/login.style.css");
        </style>
    </head>
    <body>
        <%@include file="header.jsp" %>
        <% if(Page.isMessage(request)){ %>
            <div class="message"><%= Page.getMessage(request) %></div>
        <% } %>
        <div id="login-pnl">
            <div id="login-pnl-title">LOGIN</div>
            <form action="UserController" method="POST">
            <div id="login-pnl-content">
                <div class="line center">
                    <%
                                if (sess.getAttribute("RegisterMsg") != null) {
                                    %>
                                    <div class="info" id="info"><%= sess.getAttribute("RegisterMsg") %></div>
                                    <%
                                    sess.setAttribute("RegisterMsg", null);
                                }
                        %>
                    <div class="error" id="error">&nbsp;</div>
                </div>
                <div class="line">
                    <div class="label">Username : </div>
                    <input type="text" name="txtUsername" size="20" id="u">
                </div>
                <div class="line">
                    <div class="label">Password : </div>
                    <input type="password" name="txtPassword" size="20" id="p">
                </div>
                <div class="line center">
                    <input type="button" value="Register" onclick="window.location='User?action=Register'"/>&nbsp;<input type="submit" value="Login" name="action"/>
                </div>
                
            </div>
            </form>
        </div>
        <script>
                    document.onsubmit=function(){
                        if(document.getElementById("u").value.trim()==""){
                            document.getElementById("error").innerHTML="Username can not leave blank";
                            document.getElementById("u").focus()
                            return false;
                        } else if(document.getElementById("p").value.trim()==""){
                            document.getElementById("error").innerHTML="Password can not leave blank";
                            document.getElementById("p").focus()
                            return false;
                        } else {
                            return true;
                        }

                    }
                </script>
    </body>
</html>
